<!doctype html>
<html lang="en" xmlns:v-bind="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<style>
    .active {
        color: red;
    }

    .delete {
        background: red;
    }

    .error {
        font-size: 80px;
    }
</style>
<body>

<div id="app">
    <h2>Class绑定，v-bind:class 或 :class</h2>
    <!--
        activeClass： 会从data中获取值为active，则对应样式为红色
    -->
    <p v-bind:class="activeClass">
        字符串表达式
    </p>
    <!-- isDelete 为true，渲染 delete 样式，当hasError 为false的时候，不取error样式-->
    <p :class="{delete:isDelete,error:hasError}">
        对象表达式
    </p>

    <!-- 渲染，'active','error' 样式，注意要加上单引号，不然是获取data中的值 -->
    <p :class="['active','error']">
        数组表达式
    </p>

    <h2>Style绑定，v-bind：style 或 :class</h2>
    <p :style="{color: activeColor , fontSize: fontSize+'px'}">Style绑定</p>

</div>

<script src="node_modules/vue/dist/vue.js"></script>
<script>
    new Vue({
        el: "#app",
        data: {
            activeClass: 'active',
            isDelete: true,
            hasError: true,
            activeColor: 'red',
            fontSize: 70
        }
    });
</script>

</body>
</html>
